package com.xwaf.platform.system.api.constants;

import com.google.common.base.Preconditions;

public class RawErrorCodeException extends RuntimeException {

	private static final long serialVersionUID = 1L;

	private ErrorCodeEntry errorCode;

	public RawErrorCodeException() {
		super();
	}

	/**
	 * @param errorCode
	 */
	public RawErrorCodeException(ErrorCodeEntry errorCode) {
		super();
		this.errorCode = Preconditions.checkNotNull(errorCode, "the 'errorCode' argument must not be null");
	}

	/**
	 * @param errorCode
	 * @param cause
	 */
	public RawErrorCodeException(ErrorCodeEntry errorCode, Throwable cause) {
		super(cause);
		this.errorCode = Preconditions.checkNotNull(errorCode, "the 'errorCode' argument must not be null");
	}

	public ErrorCodeEntry getErrorCode() {
		return errorCode;
	}

	@Override
	public String getMessage() {
		return this.errorCode.toString();
	}

	public void setErrorCode(ErrorCodeEntry errorCode) {
		this.errorCode = errorCode;
	}
}
